home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
dispat
/
form2.frm
< prev
next >
Wrap
Text File
|
1995-05-07
|
4KB
|
154 lines
VERSION 2.00
Begin Form Form2
BackColor = &H00FFFF80&
Caption = "Form2"
ClientHeight = 3915
ClientLeft = 6735
ClientTop = 2700
ClientWidth = 3885
Height = 4320
Left = 6675
LinkTopic = "Form2"
ScaleHeight = 3915
ScaleWidth = 3885
Top = 2355
Width = 4005
Begin TextBox dispatcher
Height = 285
Index = 0
Left = 360
TabIndex = 5
Text = "dispatcher"
Top = 2400
Visible = 0 'False
Width = 1395
End
Begin TextBox ret
BackColor = &H00FFFFFF&
Height = 285
Left = 2040
TabIndex = 0
Text = "Text1"
Top = 1380
Width = 1155
End
Begin CommandButton Command1
Caption = "Exit"
Height = 495
Left = 2520
TabIndex = 1
Top = 3240
Width = 1155
End
Begin Label arg
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
Caption = "Label3"
DataField = "Name"
DataSource = "BankCtrl"
Height = 240
Left = 2040
TabIndex = 4
Top = 780
Width = 1155
End
Begin Label Label2
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "Argument:"
Height = 240
Left = 960
TabIndex = 6
Top = 780
Width = 945
End
Begin Label Label1
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "Enter return value:"
Height = 240
Left = 240
TabIndex = 3
Top = 1440
Width = 1695
End
Begin Label subname
AutoSize = -1 'True
BackColor = &H00FFFF80&
Caption = "Label1"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 12
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 300
Left = 480
TabIndex = 2
Top = 300
Width = 825
End
End
Option Explicit
Sub Command1_Click ()
Dim retval
retval = ret ' get the return value
Unload form2
Call dispatchReturn(retval)
End Sub
Sub dispatcher_Change (index As Integer)
' dispatcher(0) = name of the sub
' dispatcher(1) = first argument
' dispatcher(2) = second arguent
' ...
' dispatcher(n) = n-th argument
If index <> 0 Then ' do nothing until we have the the name of the sub
Exit Sub
End If
Select Case dispatcher(0)
Case "Sub1"
Call sub1(dispatcher(1))
Case "Sub2"
Call sub2(dispatcher(1))
End Select
End Sub
Sub Form_Load ()
' init the dispatcher to handle one argument
Load dispatcher(1)
ret = 0
End Sub
Sub sub1 (sarg)
subname = "sub1 called"
arg = sarg
Show
End Sub
Sub sub2 (sarg)
subname = "sub2 called"
arg = sarg
Show
End Sub